home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / pcl / src-16f.lha / tools / compile-all < prev    next >
Encoding:
Text File  |  1992-03-04  |  5.5 KB  |  239 lines

  1. #!/bin/csh -f
  2. #
  3. #  compile-all -- script to compile everything
  4. #
  5. # $Header: compile-all,v 1.9 92/03/04 09:55:21 wlott Exp $
  6.  
  7. set features = ()
  8. set misfeatures = ()
  9. set target = "@sys"
  10. set subdir = alpha
  11. set core = ""
  12. set clean = 0
  13. set update = 1
  14. set bootstrap = "target:bootstrap"
  15.  
  16. set systems = ""
  17. set nosystems = ""
  18.  
  19. while ($#argv > 0)
  20.     if ("$argv[1]" !~ -*) then
  21.         set features = ($features $argv[1])
  22.     else
  23.         switch ($argv[1])
  24.  
  25. # Select what system to compile, and how:
  26.             case "-target":
  27.                 set target = $argv[2]
  28.                 shift
  29.                 breaksw
  30.             case "-release":
  31.                 set subdir = $argv[2]
  32.                 shift
  33.                 breaksw
  34.             case "-lisp":
  35.                 set lispdir = $argv[2]
  36.                 shift
  37.                 breaksw
  38.             case "-core":
  39.                 set core = " -core $argv[2]"
  40.                 shift
  41.                 breaksw
  42.             case "-bootstrap":
  43.                 set bootstrap = $argv[2]
  44.                 shift
  45.                 breaksw
  46.             case "-misfeature":
  47.                     set misfeatures = ($misfeatures $argv[2])
  48.                 shift
  49.                 breaksw
  50.  
  51. # Source tree management:
  52.             case "-clean":
  53.                 set clean = 1
  54.                 breaksw
  55.             case "-noupdate":
  56.                     set update = 0
  57.                 breaksw
  58.  
  59. # Select what to compile:
  60.             case "-compile":
  61.                     set systems = $argv[2]
  62.                 shift
  63.                 breaksw
  64.             case "-nocompile":
  65.                     set nosystems = $argv[2]
  66.                 shift
  67.                 breaksw
  68.             default:
  69.                 echo "Bogus switch: $argv[1]"
  70.                 cat <<END_HELP
  71. Try these:
  72.   -target    [@sys]    
  73.     The machine to compile for: pmax_mach, sun4c_41 ...
  74.  
  75.   -release    [alpha]
  76.     Which source tree to compile: alpha, exp/foo...
  77.  
  78.   -lisp        [/afs/cs/misc/cmucl/@sys/<release> or /usr/misc/.cmucl/]
  79.     The directory to run Lisp out of.
  80.  
  81.   -core        [<lisp>/lib/lisp.core]
  82.     The core file to run.
  83.  
  84.   -bootstrap    [target:bootstrap]
  85.     File to load into lisp before compiling.
  86.  
  87.   -misfeature <feature>
  88.     Remove <feature> from the features when compiling.  May be used more
  89.     than once.
  90.  
  91.   -clean <no arg>
  92.     Delete all *.*f, *.assem, *.log and *.log.OLD in the destination.
  93.  
  94.   -noupdate <no arg>
  95.     If specified, inhibits rcsupdate of the source tree.
  96.  
  97.   -compile    [All systems]
  98.     A comma-separated list of system names, e.g. "code,compiler".  Order is
  99.     not significant.  All systems are compiled by default.
  100.   
  101.   -nocompile    [No systems]
  102.     A comma-separated list of systems *not* to compile.  Only meaningful
  103.     when -compile is not specified.
  104.  
  105. END_HELP
  106.  
  107.                 exit
  108.         endsw
  109.     endif
  110.     shift
  111. end
  112.  
  113. if (! $?lispdir) then
  114.     set lispdir = /afs/cs/misc/cmucl/@sys/$subdir
  115.     if (! -e $lispdir) then
  116.         echo "Release $subdir not installed; using /usr/misc/.cmucl"
  117.         set lispdir = /usr/misc/.cmucl
  118.     endif
  119. endif
  120. setenv CMUCLLIB "$lispdir/lib"
  121. set lisp = "$lispdir/bin/lisp$core"
  122.  
  123. if ($systems == "") then
  124.     if ($nosystems == "") then
  125.         echo "Will compile all systems ..."
  126.     else
  127.         echo "Will compile all systems except for: $nosystems ..."
  128.     endif
  129. else
  130.     echo "Will compile these systems: $systems ..."
  131. endif
  132.  
  133. set src = ()
  134. set thissrc = /afs/cs/project/clisp/src/$subdir
  135.  
  136. nother_source:
  137.  
  138. set src = ($src \"$thissrc/\")
  139.  
  140. if (-e $thissrc/FEATURES) then
  141.         set tmp = (`cat $thissrc/FEATURES`)
  142.         echo "Features from $thissrc/FEATURES file:" $tmp
  143.     set features = ($features $tmp)
  144. endif
  145.  
  146. if (-e $thissrc/MISFEATURES) then
  147.         set tmp = (`cat $thissrc/MISFEATURES`)
  148.         echo "Misfeatures from $thissrc/MISFEATURES file:" $tmp
  149.     set misfeatures = ($misfeatures $tmp)
  150. endif
  151.  
  152. if $update then
  153.     echo "Updating source directory $thissrc ..."
  154.     (cd $thissrc; rcsupdate -q)
  155. endif
  156.  
  157. if (-e $thissrc/SHADOW) then
  158.     set thissrc = `cat $thissrc/SHADOW`
  159.     goto nother_source
  160. endif
  161.  
  162. echo "Source directory(ies): $src"
  163.  
  164. set dest = /afs/cs/project/clisp/build/$target/$subdir
  165. echo "Target directory: $dest"
  166.  
  167. if $clean then
  168.     echo "Cleaning up binaries and logs in $dest ..."
  169.     (cd  $dest;\
  170.      find . \( -name '*.*f' -o -name '*.assem' \) -print -exec rm {} \; ;\
  171.      rm *.log *.log.OLD)
  172. else
  173.     if ({(echo $dest/*.log>/dev/null)}) then
  174.     echo "Preserving log files in $dest as .OLD ..."
  175.     foreach foo ( $dest/*.log )
  176.         set old = "${foo}.OLD"
  177.         if (-e $old) then
  178.             echo "" >>$old
  179.         date >>$old
  180.         echo "_________________________________________">>$old
  181.         cat $foo >>$old
  182.         rm $foo
  183.         else
  184.         mv $foo $old
  185.         endif
  186.         end
  187.     endif
  188. endif
  189.  
  190. if ($?LISP) then
  191.     echo "LISP environment variable override: $LISP"
  192.     set lisp = "$LISP"
  193. endif
  194.  
  195. echo "Compiling setup and bootstrap ..."
  196. $lisp -noinit -eval '(eval (read))' << EOF
  197. (progn
  198.   (setf *features*
  199.     (set-difference (list* $features *features*) '($misfeatures)))
  200.   (setf (search-list "target:") '("$dest/" $src))
  201.   (setq *compile-verbose* nil *compile-print* nil) 
  202.   (load "target:tools/setup" :if-source-newer :load-source)
  203.   (comf "target:tools/setup" :load t)
  204.   (when (probe-file "${bootstrap}.lisp") (comf "$bootstrap"))
  205.   (quit))
  206. EOF
  207.  
  208. set sysinfo = ("code worldcom"\
  209.            "compiler comcom"\
  210.            "clx clxcom"\
  211.            "hemlock hemcom"\
  212.            "pcl pclcom"\
  213.            "genesis worldbuild")
  214.  
  215. while ($#sysinfo > 0)
  216.     set system_vec = ($sysinfo[1]:x)
  217.     set this_system = $system_vec[1]
  218.     set this_comfile = $system_vec[2]
  219.     shift sysinfo
  220.     if ($systems =~ *${this_system}* || \
  221.         ($systems == "" && $nosystems !~ *${this_system}*)) then
  222.     echo "Compiling $this_system ..."
  223.     $lisp -noinit -eval '(eval (read))' << EOF
  224. (progn
  225.   (setf *features*
  226.     (set-difference (list* $features *features*) '($misfeatures)))
  227.   (setf (search-list "target:") '("$dest/" $src))
  228.   (setq *compile-verbose* nil *compile-print* nil) 
  229.   (load "target:tools/setup")
  230.   (load "$bootstrap" :if-does-not-exist nil)
  231.   (setf *interactive* nil *gc-verbose* nil)
  232.   (load "target:tools/$this_comfile")
  233.   (quit))
  234. EOF
  235.    endif
  236. end
  237.  
  238. echo "Done..."
  239.